package cn.sc.summer.security.token.store;

import cn.sc.summer.security.token.store.base.BaseTokenStore;
import cn.sc.summer.token.encrypt.TokenUtil;
import cn.sc.summer.token.enums.LoginTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 类名：默认创建token机制
 *
 * @author a-xin
 * @date 2024/6/29 09:47
 */
@Slf4j
@Service
public class AppLoginTokenStore extends BaseTokenStore {

    private static final long serialVersionUID = -6656774134318132611L;

    /**
     * 获取token信息
     *
     * @param userId 用户ID
     * @return token
     */
    @Override
    public String getToken(String userId) {
        return TokenUtil.createSimpleToken(userId, LoginTypeEnum.APP);
    }

    /**
     * Determine the types of data sources supported by this class
     *
     * @return Supported types
     */
    @Override
    public String supports() {
        return LoginTypeEnum.APP.getSlogan();
    }
}
